﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebManager;

namespace BaoJian.WebManager.Manager.VIP
{
    public partial class List : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LYQ.BLL.VIPPartner bll = new LYQ.BLL.VIPPartner();
                DataSet ds;
                if (Utility.CurrentSysUser().UName.ToLower() != "admin")
                {
                     ds = bll.GetList("region='" + Utility.CurrentSysUser().UName + "'");
                }
                else
                {
                    ds = bll.GetList("");
                }
                //DataSet ds = bll.GetList("region='"+Utility.CurrentSysUser().UName+"'");
                GridView1.DataSource = ds.Tables[0];
                GridView1.DataBind();
      
               
            }
        }

        private void BindData()
        {
        }
        protected void New_Click(object sender, EventArgs e)
        {
            string url = URLUtility.UrlBase + "/WebManager/manager/vip/New.aspx";
            Page.Response.Redirect(url);
        }

        protected void Edit_Click(object sender, EventArgs e)
        {
            if (HttpContext.Current.Request.Form["selectCB"] == null) return;
            string[] sel = Request.Form["selectCB"].Split(',');
            //if(sel.Length > 1)
            string url = URLUtility.UrlBase + "/WebManager/manager/vip/Edit.aspx?VIPID=" + sel[0];
            Page.Response.Redirect(url);
        }

     
        protected void Delete_Click(object sender, EventArgs e)
        {
            if (HttpContext.Current.Request.Form["selectCB"] == null) return;
            string[] sel = Request.Form["selectCB"].Split(',');


            LYQ.BLL.VIPPartner bll = new LYQ.BLL.VIPPartner();
            foreach (string oid in sel)
            {
                bll.Delete(oid);
            }

            string url = URLUtility.UrlBase + "/WebManager/manager/vip/List.aspx";
            Page.Response.Redirect(url);
        }
    }
}
